package com.xxx.controller;


import com.atguigu.commonutils.R;
import com.xxx.pojo.User;
import com.xxx.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@CrossOrigin
@Api(tags = "LoginController")
@RequestMapping("/admin/acl")
public class LoginController {

    @Autowired
    private UserService userService;

    @ApiOperation("登录返回token")
    @PostMapping("/login")
    public R login(@RequestBody User user, HttpServletRequest request) {
        return userService.login(user.getUsername(), user.getPassword(), request);
    }

}
